#ifndef PDASOBJECT_H
#define PDASOBJECT_H

#include "a48.h"
#include "camera.h"
#include "model_display.h"

using namespace A48;
typedef unsigned char byte;

class PADSNode
{
public:
	PADSNode(VCGCamera *camera, Patch *p, ModelDisplay *instance, Mesh *minstance);
	float distToCamera(Vec3 vec);
	void extractBB(int sw, int sh);
	void outputToFile(char *filename);
	int getBB_X(){return bb_x;}
	int getBB_Y(){return bb_y;}
	int getBB_W(){return bb_w;}
	int getBB_H(){return bb_h;}
	float getDist(){return dist_plane;}
	float getDx(){return plane_dx;}
	//calcPlane();
private:
	int scr_w, scr_h;
	int bb_x, bb_y, bb_w, bb_h; //with and height from stencil and characteristic function
	Vec3 cam_pos; //camera position
	float dist_plane; //distance to the plane
	float plane_dx;
	Vec3 plane_normal; //vector from plane pointing to the camera
};

class PADSPatch
{
public:
	PADSPatch(){}
	~PADSPatch()
	{
		delete p;
		delete n;
		delete c;
	}
	int index;
	int cam_index;
	byte *p;
	byte *n;
	byte *c;
};

class PADSObject
{
public:
	PADSObject(Mesh *mesh);
	~PADSObject()
	{
		delete patches;
		delete filename;
	}
	//writeToFile(char *filename);
private:
	PADSPatch *patches;
	Mesh *minstance;
	int num_patches;
	char *filename;
};

#endif

